package com.dict;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import android.util.Log;

public class WotdXMLHandler extends DefaultHandler {
	Boolean curElement = false;
	String curValue = null;
	public static XMLList list;

	public static XMLList getXMLList() {
		return list;
	}

	public static void setXMLList(XMLList list) {
		WotdXMLHandler.list = list;
	}


	@Override
	public void startElement(String uri, String tagName, String qName,
			Attributes attributes) throws SAXException {

		curElement = true;
		String att;
		int i = 0;
		if (tagName.equals("wordoftheday"))
		{
			/** Start */
			list = new XMLList();

		}	
	}


	@Override
	public void endElement(String uri, String tagName, String qName)
			throws SAXException {

		curElement = false;

		/** set value */

		if (tagName.equalsIgnoreCase("word"))
			list.setWord(curValue);

	}


	@Override
	public void characters(char[] ch, int start, int length)
			throws SAXException {

		if (curElement) {
			curValue = new String(ch, start, length);
			curElement = false;
		}

	}

}
